home *** CD-ROM | disk | FTP | other *** search
/ Software of the Month Club 1995 March / SOFM_Mar1995.bin / mac / General Interest / KeyQuencer 1.2.1 / Documentation / Tips and hints / PopUpMenu and Microsoft Word < prev    next >
Text File  |  1994-07-31  |  2KB  |  19 lines

  1. PopUpMenu doesn't work inside Microsoft Word 5.1 (and possibly other Microsoft applications) because Word doesn't use the standard Macintosh pop up menus. The people at Microsoft like to do everything in their very own, very special, very incompatible way.
  2.  
  3. If you really have to automate pop up menus in Word, you'll have to use the new Drag extension (which simulates a real mouse drag). This is not an easy task, since you have to find the coordinates of the initial and final locations of the mouse drag. Here's an example that shows how to save a Word file in a specific format by choosing an item from the pop up menu in the "Save as╔" dialog:
  4.  
  5. SwitchApp "Word" partial
  6. Menu "File" "Save as╔"
  7. WaitWindow dialog
  8. MoveWindow top
  9. Drag from 120 200 to 0 48 relative window slower
  10. Button "Desktop"
  11. Type "My File In Other Format"
  12. Wait 6
  13. Key enter
  14.  
  15. The "MoveWindow top" command is needed because we want the pop up menu to be drawn below the pop up menu rectangle; if the window is too close to the bottom of the screen, the menu doesn't fit below the rectangle so Word draws it above. We could also drag the mouse upwards, but we have to know for sure whether the menu will be drawn above or below.
  16.  
  17. The Drag command works as follows: 120 and 200 are the horizontal and vertical coordinates of a point inside the pop up menu rectangle, where the dragging starts. 0 and 48 are the horizontal and vertical offsets from the initial position (they are treated as offsets because of the "relative" keyword); if each line of the pop up menu takes 16 pixels vertically, then "0 48" means "move to the third item of the pop up menu". The "window" keyword makes the Drag command treat all coordinates as window coordinates (instead of screen coordinates). The "slower" keyword slows down the mouse drag; this is needed because Word takes some time to respond to the user action, so the pop up menu selection doesn't change if the drag is too fast.
  18.  
  19. For the technically inclined: Word never calls PopUpMenuSelect. Instead, it handles pop up menus with a custom CDEF that does all the drawing and mouse tracking by itself.